<?php
  if (!defined('EXPONENT')) exit('');
  if (exponent_users_isAdmin() ||  exponent_permissions_check(array("administrate"),$loc))
  {   
	  //exponent_flow_set(SYS_FLOW_PROTECTED,SYS_FLOW_ACTION);
	  
	  require_once(BASE."modules/formhelpermodule/formhelper.php");
	  $formhelper=new formhelper("administrationmodule","_manager_log_title","_manager_log",$loc);
		$formhelper->setGridType(FORMHELPER_GRID_TYPE_DATAGRID);
		$formhelper->setGridOptions("height",650);
		$formhelper->setGridOptions("idField","id");
		$formhelper->setGridOptions("pagination",1);
		$formhelper->setGridOptions("pageNumber","1");
		$formhelper->setGridOptions("pageSize","20");
		$formhelper->setGridOptions("rownumbers","true");
		$formhelper->setGridOptions("nowrap","false");
		$formhelper->setGridOptions("singleSelect","true");
		$formhelper->setGridOptions("autoRowHeight","true");
		$formhelper->setGridOptions("onDblClickRow","function(___grid_syslog_dbrow");
		
		$formhelper->setGridID("sys_log");
		$js=URL_FULL."modules/administrationmodule/js/Manager_Log.js";
		$formhelper->addJS($js);
		
		$css=URL_FULL."modules/administrationmodule/css/log_manage.css";
		$formhelper->addCss($css);
		
		$formhelper->setColumnType(1);
		$formhelper->addColumn(array("field"=>"error_type","title"=>"Error",'width'=>100,"resizable"=>"false","sortable"=>"true","formatter"=>"function(___column_error_formatter"));
		$formhelper->addColumn(array("field"=>"error_str","title"=>"Description",'width'=>300));
		$formhelper->addColumn(array("field"=>"error_file","title"=>"File",'width'=>210));
		$formhelper->addColumn(array("field"=>"error_line","title"=>"Line",'width'=>40));
		$formhelper->addColumn(array("field"=>"error_date_string","title"=>"On Date",'width'=>90,"resizable"=>"false","sortable"=>"true"));
		$formhelper->addColumn(array("field"=>"in_dev","title"=>"In Dev",'width'=>50,"resizable"=>"false","sortable"=>"true", "formatter"=>"function(___column_indev_formatter"));
		$formhelper->addColumn(array("field"=>"client_info","title"=>" Client Info",'width'=>150,"formatter"=>"function(___column_clientinfo_formatter"));
		
		$link_param="/index.php?module=administrationmodule&action=log_manage_getjson&src={$loc->src}&ajax_action=1";
		$formhelper->setURLDataStream($link_param);
		$formhelper->setGridOptions("onBeforeLoad","function(___form_onBeforeLoad");
		$toolbar_template=new template("administrationmodule","_Manager_Log_ToolbarHTML",$loc);
		$toolbar_template->register_permissions(array('administrate',"configure"),$loc);
		$toolbar_html=$toolbar_template->render();
		$formhelper->addToolbarHTML($toolbar_html);
		$formhelper->addToolbarStyle('height:75px');
		$formhelper->setPreInitJSCall("form_syslog_preinit");
		$formhelper->register_permissions(array('administrate',"configure"),$loc);
		$formhelper->output();
         exponent_sessions_set("AB_THEME_TOP_CONTAINER_SRC","top_systemmodule_".LANG);
    exponent_sessions_set("AB_THEME_TOP_CONTAINER_TYPE","textmodule");
  }
  else
	{
		echo exponent_http_error(403);
	}
?>
